package com.pink.entity.config;

import org.springframework.stereotype.Component;

@Component
public class Constants {
    public static final int LENGTH_1 = 1;
    public static final int LENGTH_2 = 2;
    public static final Integer LENGTH_15 = 15;
    public static final Integer LENGTH_30 = 30;
    public static  final int ORDER_CORS = -102;
    public static  final int ORDER_LIMIT = -101;
    public static final Long MB_SIZE = 1024 * 1024L;


    /**
     * 文件路径定义
     */
    public static final String FILE_FOLDER = "public/"; //文件存储路径
    public static final String FILE_COVER = "cover/"; //封面图片存储路径
    public static final String FILE_USER_IMAGE = "image/"; //头像图片存储路径
    public static final String FILE_VIDEO = "video/"; //视频存储路径
    public static final String FILE_FOllDER_TEMP = "temp/"; //临时文件存储路径
    public static final String IMAGE_THUMBNAIL_SUFFIX = "_thumbnail.jpg"; //临时封面图片存储路径
    public static final String TEMP_VIDEO_NAME = "/temp.mp4"; //临时视频存储路径
    public static final String TS_NAME = "index.ts"; //ts文件名称
    public static final String M3U8_NAME = "index.m3u8"; //索引文件名称

    /**
     * 正则表达式定义
     */
    public static final String REGEX_NAME = "^[\\u4e00-\\u9fa5a-zA-Z0-9_]{3,20}$";//用户名长度3-20，允许全部类型字符,不允许纯数字开头
    public static final String REGEX_PASSWORD = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$"; //密码正则表达式
    public static final String REGEX_EMAIL = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"; //邮箱正则表达式
    public static final String REGEX_PHONE = "^1[3456789]\\d{9}$"; //手机号正则表达式

    /**
     * redis过期时间定义
     */
    public static final Integer REDIS_KEY_EXPIRES_ONE_MIN= 60000; //过期时间一分钟(毫秒)
    public static final Integer REDIS_KEY_EXPIRES_ONE_DAY= 24 * 60 * REDIS_KEY_EXPIRES_ONE_MIN; //过期时间一天(毫秒)
    public static final Integer TIME_SECONDS_DAY = REDIS_KEY_EXPIRES_ONE_DAY / 1000 ; //过期时间一天(秒)

    /**
     * redis key前缀定义
     */
    public static final String REDIS_KEY_PREFIX = "pink:"; //redis key前缀ss
    public static final String REDIS_KEY_CHECK_CODE_KEY = REDIS_KEY_PREFIX + "checkcode:"; //redis key前缀ss
    public static final String FLOW_LIMIT_COUNTER = REDIS_KEY_PREFIX + "flow:counter:";//流量计数器
    public static final String FLOW_LIMIT_BLOCK = REDIS_KEY_PREFIX + "flow:block:";//流量限制
    public static  final String JWT_BLACK_LIST = REDIS_KEY_PREFIX + "jwt:blacklist:";
    public static String REDIS_KEY_CHECK_CODE = REDIS_KEY_PREFIX + "emailcode:"; //验证码key前缀
    public static String REDIS_KEY_USER = REDIS_KEY_PREFIX + "user:"; //用户key前缀
    public static String REDIS_KEY_EMAIL = REDIS_KEY_PREFIX + "user:email:Count"; //邮箱发送次数key前缀
    public static String REDIS_KEY_EMAIL_CODE = REDIS_KEY_PREFIX + "user:email:Code"; //邮箱验证码key前缀
    public static String REDIS_KEY_QUEUE_EMAIL = REDIS_KEY_PREFIX + "user:email:"; //邮箱队列key前缀
    public static String REDIS_KEY_USER_LOGIN = REDIS_KEY_PREFIX + "user:login:"; //用户登录设备统计key前缀
    public static String REDIS_KEY_UPLOADING_FILE = REDIS_KEY_PREFIX + "uploading"; //上传文件key前缀
    public static String REDIS_KEY_SYS_SETTING = REDIS_KEY_PREFIX + "sysSetting"; //系统设置key前缀
    public static String REDIS_KEY_FILE_DEL = REDIS_KEY_PREFIX + "file:list:del:"; //文件删除列表key前缀
    public static String REDIS_KEY_QUEUE_TRANSFER = REDIS_KEY_PREFIX + "queue:transfer:"; //文件删除列表key前缀

    /**
     * Token定义
     */
    public static String TOKEN_WEB =  "token"; //web端token
    public static String TOKEN_ADMIN =  "adminToken"; //后台管理端token
    public static String TOKEN_HEADER = "Authorization"; //token请求头

    /**
     * 视频编码定义
     */
    public static String VIDEO_CODEC_H264 = "h264";
    public static String VIDEO_CODEC_H265 = "h265";
    public static String VIDEO_CODEC_HEVC = "hevc";
    public static String VIDEO_CODEC_H263 = "h263";
    public static String VIDEO_CODEC_TEMP_FILE_SUFFIX = "_temp";
}
